package com.example.service.impl;

import com.example.service.MessageServices;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Map;

@Service
public class MessageServiceRabbitmqImpl implements MessageServices {

    @Resource
    private AmqpTemplate amqpTemplate;

    @Override
    public void sendMessage(Map<String,String> map) {
        System.out.println("待发送短信的订单存到消息队列（Rabbitmq direct），id："+map.get("content"));
        //将消息存入队列中
        amqpTemplate.convertAndSend("DirectExchange","direct",map);
    }
}
